var a:array['a'..'z']of longint;
    s,st:string;
    p,i:longint;
procedure dfs(dep:longint);
var c:char;
begin
    if dep>length(s) then
    begin
        inc(p);
        if st=s then
        begin
            writeln(p);
            halt;
        end;
    end
    else
    begin
        for c:='a' to 'z' do
          if a[c]>0 then
          begin
              dec(a[c]);
              st:=st+c;
              dfs(dep+1);
              inc(a[c]);
              st:=copy(st,1,dep-1);
          end;
    end;
end;
begin
    while not eof do
    begin
        readln(s);
        fillchar(a,sizeof(a),0);
        for i:=1 to length(s) do inc(a[s[i]]);
        p:=0;
        st:='';
        dfs(1);
    end;
end.
